package com.wushijia.datastructure;

public class ShiYan10
{	
	//�ݹ�ʵ���۰���ң�����ҵ�����ѱ��ҵ���Ԫ���������е��±귵�أ��Ҳ����򷵻�-1
	public static int binarySearchRecursion(Comparable[] table, Comparable cobj, int low, int high)
    {
		return high;                                                 
    	//�˴���Ӵ���   
    }  
    
    public static int binarySearchRecursion(Comparable[] table, Comparable cobj)  
    {                     
        return binarySearchRecursion(table, cobj, 0, table.length-1);
    }  
    
    public static void print(Object[] table)                  
    {
        if (table!=null)
            for (int i=0; i<table.length; i++)
                System.out.print(" "+table[i]);
        System.out.println();
    }
    
    public static void main(String[] args)
    {
        Integer[] table ={new Integer(8),new Integer(17),new Integer(26),new Integer(32),new Integer(40),new Integer(72),new Integer(87),new Integer(99)};        
        System.out.print("array table is:");
        print(table);
        Integer key=new Integer(40);
        System.out.println("\n"+key+", "+((binarySearchRecursion(table,key)==-1)?"not find!":"find!"));
        key=new Integer(25);
        System.out.println("\n"+key+", "+((binarySearchRecursion(table,key)==-1)?"not find!":"find!"));
    }
}

